#include "filterdll.h"
#include <future>

#include "FileHooker.h"
#include "ProcessHooker.h"
#include "SocketHooker.h"


using namespace XProcess;

FilterDll::FilterDll()
{

}

FilterDll::~FilterDll()
{
    fileHooker.unhook();
    processHooker.unhook();
    socketHokker.unhook();
}


void FilterDll::main()
{
    fileHooker.hook();
    processHooker.hook();
    socketHokker.hook();
}

FilterDll *filter = nullptr;
bool filterStart()
{
    std::async(std::launch::async, []
    {
        if (filter)
        {
            delete filter;
        }
        filter = new FilterDll;
        filter->main();
    });
    return true;
}

bool filterStop()
{
    if (filter)
    {
        delete filter;
        return true;
    }
    return false;
}